
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>layui表单生成器</title>
    <link rel="stylesheet" href="/static/admin/component/pear/css/pear.css">
    <link rel="stylesheet" href="/static/admin/component/code/css/style.css">
</head>
<body>
    <div class="layui-fluid">
        <table class="layui-table">   
            <tbody>
                <tr>
                <td>列表 1</td>
                <td><button class="layui-btn layui-btn-sm demolist" data-id="111">更多操作</button></td>
                </tr>
                <tr>
                <td>列表 2</td>
                <td><button class="layui-btn layui-btn-sm demolist" data-id="222">更多操作</button></td>
                </tr>
                <tr>
                <td>列表 3</td>
                <td><button class="layui-btn layui-btn-sm demolist" data-id="333">更多操作</button></td>
                </tr>
            </tbody>
            </table>
    </div>
</body>
<script type="text/javascript" src="/static/admin/component/layui/layui.js"></script>
<script type="text/javascript" src="/static/admin/component/pear/pear.js"></script>
<script>
layui.use('dropdown', function(){
    var dropdown = layui.dropdown
    ,$ = layui.jquery;
    
    dropdown.render({
        elem: '.demolist'
        ,data: [{
        title: 'item 1'
        ,id: 'aaa'
        }, {
        title: 'item 2'
        ,id: 'bbb'
        }]
        ,click: function(data, othis){
        var elem = $(this.elem)
        ,listId = elem.data('id'); //表格列表的预埋数据
        layer.msg('得到表格列表的 id：'+ listId +'，下拉菜单 id：'+ data.id);
        }
    });
});
</script>
</html>
